package core;

import java.util.HashMap;
import java.util.Map;

/**
 * contains TransmitterNodes, each one with a "public" (external) port 
 * and a "private" (internal) port.
 * @author Wijnand
 */
public class TransmitterCollectionNode extends StdNode {
	
	Map<String, TransmitterNode> transmitterNodes = new HashMap<String, TransmitterNode>();
	
	public void putInPort(String name, Class valueClass)
	{
		ValueTransmitterNode vt = new ValueTransmitterNode(valueClass);
		this.transmitterNodes.put(name, vt);
		vt.ports.put(name, vt.getInPort());
	}
	public void putOutPort(String name, Class valueClass)
	{
		ValueTransmitterNode vt = new ValueTransmitterNode(valueClass);
		this.transmitterNodes.put(name, vt);
		vt.ports.put(name, vt.getOutPort());
	}
	public void putTriggerPort(String name)
	{
		TriggerTransmitterNode tt = new TriggerTransmitterNode();
		this.transmitterNodes.put(name, tt);
		tt.ports.put(name, tt.getTriggerPort());
	}
	public void putDispatcherPort(String name)
	{
		TriggerTransmitterNode tt = new TriggerTransmitterNode();
		this.transmitterNodes.put(name, tt);
		tt.ports.put(name, tt.getDispatcherPort());
	}
	
	public TransmitterNode getTransmitterNode(String name)
	{
		return this.transmitterNodes.get(name);
	}
}
